﻿using System;

namespace IupNET
{
    public class Label:Control {
        public Label()
            : base(Iupc.Label(null))
        {
            
        }

        
        public Alignment Alignment
        { //TODO: handle compined aligns (see iup manual)
            get
            {
                return Convert.StringToAlign(GetAttribute("ALIGNMENT"));
            }
            set
            {
                SetAttribute("ALIGNMENT", Convert.AlignToString(value));
            }
        }

        public bool Ellipsis
        {
            get
            {
                return GetAttribute("ELLIPSIS") == "YES";
            }
            set
            {
                SetAttribute("ELLIPSIS", value ? "YES" : "NO");
            }
        }

        public Image Image
        {
            set
            {
                string n = value.HandleName;
                if (n == null)
                    return;
                SetAttribute("IMAGE", n);
            }
        }

        public Image ImInactive
        {
            set
            {
                string n = value.HandleName;
                if (n == null)
                    return;
                SetAttribute("IMINACTIVE", n);
            }
        }

        public bool Markup
        {
            get
            {
                return GetAttribute("MARKUP") == "YES";
            }
            set
            {
                SetAttribute("MARKUP", value ? "YES" : "NO");
            }
        }

        public Size2i Padding
        {
            get
            {
                return Convert.StringToSize(GetAttribute("PADDING"));
            }
            set
            {
                SetAttribute("PADDING", Convert.SizeToString(value));
            }
        }

       /* public Orientation Separator
        {
            get
            {
                return Convert.StringToOrientation(GetAttribute("SEPARATOR"));
            }
            set
            {
                SetAttribute("SEPARATOR", Convert.OrientationToString(value));
            }
        }*/


        public Orientation Separator
        {
            get
            {
                if (GetAttribute("SEPARATOR") == "VERTICAL")
                    return Orientation.Vertical;
                return Orientation.Horizontal;
            }
            set
            {
                if (value == Orientation.Vertical)
                    SetAttribute("SEPARATOR", "VERTICAL");
                else
                    SetAttribute("SEPARATOR", "HORIZONTAL");
            }
        }
        
        

        public bool WordWrap
        {
            get
            {
                return GetAttribute("WORDWRAP") == "YES";
            }
            set
            {
                SetAttribute("WORDWRAP", value ? "YES" : "NO");
            }
        }

    }
}
